﻿
@{
    ViewData["Title"] = "manager";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div id="dept" class="demo-tree-more"></div>

<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
    <legend>常规用法</legend>
</fieldset>

<script>


    </script>
<script>
    
layui.use(['tree', 'util'], function() {
    var tree = layui.tree;
    var util = layui.util;
    tree.render({
        elem: '#dept',
        data: getData(),
        id: 'treeId',
        showCheckbox: false,     //是否显示复选框
        onlyIconControl: true
    });
});



    
function getData(){
    var data = [];
    $.ajax({
        url: "/admin/GetDeptList",    //后台数据请求地址
        type: "post",
        async:false,
        success: function(resut){
            data = resut;
        }
    });
    return data;
}



    layui.use(['tree', 'util'], function () {
        var tree = layui.tree
            , layer = layui.layer
            , util = layui.util
     tree.render({
    elem: '#dept' //默认是点击节点可进行收缩
    ,data: '/admin/GetDeptList'
  });
    });
    

</script>